package org.jeecg.modules.charge.vo;

import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

/**
 * 
 * @author Lee
 *
 *
 *
 *解析properties文件
 */
public class AnalysisProperties {
	static org.slf4j.Logger log = org.slf4j.LoggerFactory.getLogger(AnalysisProperties .class);
	//使用单例
	private static AnalysisProperties ap=null;
	private static Properties pp=null;
	//私有化构造方法
	private AnalysisProperties(){
		String myuri="application-dev.yml";
		pp=new Properties();
		InputStream inStream=AnalysisProperties.class.getClassLoader().getResourceAsStream(myuri);
		try {
			pp.load(inStream);
			inStream.close();
		} catch (IOException e) {
			log.error(e.getMessage(), e);
		}
	}
	//获取实例
	public static AnalysisProperties getInstance(){
		if(ap==null){
			ap=new AnalysisProperties();
		}
		return ap;
	}
	public String getString(String key){
		return pp.getProperty(key);
	}
}
